#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
RUN apt-get update; apt-get install libfontconfig1 -y

WORKDIR /app
EXPOSE 63725

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["TradeDataAPI.WebApi/TradeDataAPI.WebApi.csproj", "TradeDataAPI.WebApi/"]
COPY ["TradeDataAPI.System/TradeDataAPI.System.csproj", "TradeDataAPI.System/"]
COPY ["TradeDataAPI.Core/TradeDataAPI.Core.csproj", "TradeDataAPI.Core/"]
COPY ["TradeDataAPI.Entity/TradeDataAPI.Entity.csproj", "TradeDataAPI.Entity/"]
COPY ["TradeDataAPI.Order/TradeDataAPI.Order.csproj", "TradeDataAPI.Order/"]
COPY ["TradeDataAPI.AppManager/TradeDataAPI.AppManager.csproj", "TradeDataAPI.AppManager/"]
COPY ["TradeDataAPI.Builder/TradeDataAPI.Builder.csproj", "TradeDataAPI.Builder/"]
RUN dotnet restore "TradeDataAPI.WebApi/TradeDataAPI.WebApi.csproj"
COPY . .
WORKDIR "/src/TradeDataAPI.WebApi"
RUN dotnet build "TradeDataAPI.WebApi.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "TradeDataAPI.WebApi.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "TradeDataAPI.WebApi.dll"]